<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>测试js的promise的then传递</title>
    <script src="../zujian/han/han.js"></script>

</head>
<body>
<script type="text/javascript">
    //返回 then里面的,也就是说只要有 resolve(k)调用,就不会有reject的调用生效
    //
    new Promise((resolve,reject)=>{
        var k=true
        if(!k){
            // throw new Error("xxxx444444")
            resolve({"k":"成功"})
        }else{
            reject("失败")//这里成功了下面也会走，而且会先走      alert("yyyyyyyyy")
        }
        alert("yyyyyyyyy")
        // reject(false)
    }).then(v=>{
        // hwrite(v,222,333)
        alert(v.k)
    }).catch(error=>{
        alert("ppppppppp")
        // hwrite(error,666,777)
        alert(error)
    })
</script>
</body>
</html>